package com.hdax.dm.mappers;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hdax.dm.beans.item.Item;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ItemMapper extends BaseMapper<Item> {
    /**
     * 热门商品
     * @return
     */
    @Select(value = {
            "<script>",
                "SELECT * FROM dm_item",
                    "<where>",
                        "<if test=\"itemType1Id!=-1\">AND itemType1Id=#{itemType1Id}</if>",
                        "<if test=\"isBanner!=-1\">AND isBanner=#{isBanner}</if>",
                    "</where>",
                    " ORDER BY startTime DESC",
                    " LIMIT 5",
            "</script>"
    })
    List<Item> items(@Param("itemType1Id")Long itemType1Id, @Param("isBanner")Long isBanner);
}
